package dzz.Week1;

public class JianZhiOffer05_ReplaceSpaces {

    // 遍历添加
    class Solution {
        public String replaceSpace(String s) {
            StringBuilder res = new StringBuilder();
            for(Character c : s.toCharArray())
            {
                if (c == ' ') {
                    res.append("%20");
                } else {
                    res.append(c);
                }
            }
            return res.toString();
        }
    }

}
